package org.yu.team2023.flashdays.client;

import net.minecraft.client.KeyMapping;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.settings.IKeyConflictContext;
import net.minecraftforge.client.settings.KeyConflictContext;
import org.lwjgl.glfw.GLFW;
import org.yu.team2023.flashdays.FlashDays;

import java.util.ArrayList;
import java.util.List;

@OnlyIn(Dist.CLIENT)
public class ModInputs {
    public static final List<KeyMapping> ALL_KEY_MAPPINGS = new ArrayList<>();
    public static final String MOD_CATEGORY = "key.categories." + FlashDays.MODID;
    //public static final KeyMapping SKILL_0 = registerInGame(GLFW.GLFW_KEY_G, "skill0", "技能0");
    //public static final KeyMapping SKILL_1 = registerInGame(GLFW.GLFW_KEY_H, "skill1", "技能1");
    //public static final KeyMapping SKILL_2 = registerInGame(GLFW.GLFW_KEY_J, "skill2", "技能2");
   //public static final KeyMapping SKILL_PANEL = registerInGame(GLFW.GLFW_KEY_UNKNOWN, "skill_panel", "技能面板");

    @SuppressWarnings("all")
    private static KeyMapping registerInGame(int key, String keyName, String desc) {
        return register(key, KeyConflictContext.IN_GAME, keyName, desc);
    }

    @SuppressWarnings("all")
    private static KeyMapping register(int key, IKeyConflictContext context, String keyName, String desc) {
        var keyMap = new KeyMapping("key.open." + keyName, key, MOD_CATEGORY);
        ALL_KEY_MAPPINGS.add(keyMap);
        keyMap.setKeyConflictContext(context);
        FlashDays.getSimpleReg().lang(keyMap.getName(), desc);
        return keyMap;
    }
    public static void init(){
        FlashDays.getSimpleReg().lang(MOD_CATEGORY,"闪光日");
    }
}
